CC=g++
CFLAGS=-g -c
DIR_OBJ=./obj
DIR_SRC=./src
DIR_INC=./include
DIR_BIN=./bin
DIR_LIB=/usr/local/lib

SRCS=$(DIR_SRC)/gen-cpp/SimilarCharacter.cpp\
		 $(DIR_SRC)/gen-cpp/si_constants.cpp\
		 $(DIR_SRC)/gen-cpp/si_types.cpp\
		 $(DIR_SRC)/si.cpp
		 

OBJS=$(patsubst %.cpp, $(DIR_OBJ)/%.o, $(notdir $(SRCS)))

target:SiServer SiClient

SiServer:$(OBJS) $(DIR_OBJ)/SiServer.o
	$(CC) $(OBJS) $(DIR_OBJ)/SiServer.o -static -lthriftnb -lthrift -levent -lpthread -lrt -o $(DIR_BIN)/SiServer
	@echo "-----------------------Compile and Link Successfully-----------------------"

SiClient:$(OBJS) $(DIR_OBJ)/SiClient.o
	$(CC) $(OBJS) $(DIR_OBJ)/SiClient.o -static -lthrift -lpthread -o $(DIR_BIN)/SiClient
	@echo "-----------------------Compile and Link Successfully-----------------------"

$(DIR_OBJ)/SimilarCharacter.o:$(DIR_SRC)/gen-cpp/SimilarCharacter.cpp
	$(CC) $(CFLAGS) $(DIR_SRC)/gen-cpp/SimilarCharacter.cpp -I$(DIR_INC) -o $(DIR_OBJ)/SimilarCharacter.o

$(DIR_OBJ)/si_constants.o:$(DIR_SRC)/gen-cpp/si_constants.cpp
	$(CC) $(CFLAGS) $(DIR_SRC)/gen-cpp/si_constants.cpp -I$(DIR_INC) -o $(DIR_OBJ)/si_constants.o

$(DIR_OBJ)/si_types.o:$(DIR_SRC)/gen-cpp/si_types.cpp
	$(CC) $(CFLAGS) $(DIR_SRC)/gen-cpp/si_types.cpp -I$(DIR_INC) -o $(DIR_OBJ)/si_types.o

$(DIR_OBJ)/si.o:$(DIR_SRC)/si.cpp $(DIR_INC)/si.h
	$(CC) $(CFLAGS) $(DIR_SRC)/si.cpp -I$(DIR_INC) -o $(DIR_OBJ)/si.o

$(DIR_OBJ)/SiServer.o:$(DIR_SRC)/SiServer.cpp
	$(CC) $(CFLAGS) $(DIR_SRC)/SiServer.cpp -I$(DIR_INC) -o $(DIR_OBJ)/SiServer.o

$(DIR_OBJ)/SiClient.o:$(DIR_SRC)/SiClient.cpp
	$(CC) $(CFLAGS) $(DIR_SRC)/SiClient.cpp -I$(DIR_INC) -o $(DIR_OBJ)/SiClient.o
